package com.procurement.inquiry.controller;

import com.alibaba.fastjson2.JSONArray;
import com.procurement.inquiry.domain.PcmMaterialPrice;
import com.procurement.inquiry.domain.ProductNumber;
import com.procurement.inquiry.service.PcmCheckService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/check")
public class PcmCheckController extends BaseController {

    @Autowired
    private PcmCheckService pcmCheckService;
    @GetMapping("/list/{inquiryDemandNumber}")
    public TableDataInfo selectList(@PathVariable("inquiryDemandNumber")String inquiryDemandNumber){
        System.out.println(inquiryDemandNumber);
        return getDataTable(pcmCheckService.PcmSupplierQuotationList(inquiryDemandNumber));
    }
    @PostMapping(value = "/insertP")
    public AjaxResult insertPrice(@RequestBody List<PcmMaterialPrice> pcmMaterialPrice){
        System.out.println(new JSONArray(pcmMaterialPrice));
        pcmCheckService.insertPcmMaterialPrice(pcmMaterialPrice);
        return toAjax(1);
    }
    @PostMapping("/cisu")
    public TableDataInfo selectProduct(){
        List<ProductNumber> list= pcmCheckService.selectProductNumber();
     return getDataTable(list);
    }
    @GetMapping("/xuqiu")
    public TableDataInfo selectInquiry(){
       return getDataTable(pcmCheckService.selectInquiry());
    }
    @GetMapping("/cpbh")
    public TableDataInfo selectProductNumber(){
        return getDataTable(pcmCheckService.selectProductNumber2());
    }
    @GetMapping("/cpmc")
    public TableDataInfo selectProductName(){
        return getDataTable(pcmCheckService.selectProductName());
    }
    @GetMapping("/gys")
    public TableDataInfo selectSupplier(){
        return getDataTable(pcmCheckService.selectSupplier());
    }
    @GetMapping("/fromlist")
    public TableDataInfo selectPcmSupplierQuotation(){
        startPage();
        return getDataTable(pcmCheckService.selectPcmSupplierQuotation());
    }
}
